﻿using MvvmFx.Common.ViewModels;


namespace MvvmFx.Samples.HowTos.ViewModelHelper.ViewModels
{
    public class ItemsControlSampleViewModel : SampleViewModel
    {
        #region instance variables

        private readonly ViewModelCollection<SampleItemViewModel> _samples;

        #endregion


        #region constructors

        public ItemsControlSampleViewModel()
        {
            // initialize instance variables
            _samples = new ViewModelCollection<SampleItemViewModel>();

            // generate sample data
            const int sampleCount = 10;
            _samples.AddRange(SampleItemViewModel.Create(sampleCount));
        }

        #endregion


        #region properties

        public override string Title
        {
            get { return "ItemsControl Sample"; }
        }

        public override string Description
        {
            get
            {
                return "The ItemsControl below is bound using the ViewModelHelper.ItemsSource "
                    + "property and the rendered ViewModels are rendered using an implicit "
                    + "DataTemplate defined in the parent view.";
            }
        }

        public ViewModelCollection<SampleItemViewModel> Samples
        {
            get { return _samples; }
        }

        #endregion

    }  // class ItemsControlSampleViewModel

}  // namespace MvvmFx.Samples.HowTos.ViewModelHelper.ViewModels
